package com.yyz.zjjcms.service.impl;

import javax.annotation.Resource;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.yyz.helper.Pagenation;

import com.yyz.zjjcms.model.User;
import com.yyz.zjjcms.repository.UserRepository;
import com.yyz.zjjcms.service.UserService;
@Service
public class UserServiceImpl implements UserService {

	@Resource
	UserRepository ur;

	@Override
	public Pagenation<User> getAllUser(int page, int rows) {
		// TODO Auto-generated method stub
		Pagenation<User> pau = new Pagenation<User>(page, rows);
		Page<User> pu = ur.findAll(new PageRequest(page-1, rows));
		pau.setRows(pu.getContent());
		pau.setTotal(pu.getTotalElements());
		return pau;
	}

}
